<?php
 @header("Content-Type:text/html;charset=utf-8");


const host = 'b-na2upzpalis8iq.bch.rds.gz.baidubce.com';
const user = 'b_na2upzpalis8iq';
const pwd = "123456789";
const dbName = "b_na2upzpalis8iq";

$conn = mysqli_connect(host,user,pwd,dbName);
if(!$conn){
    exit('数据库链接有误');
}

// 转码设置  => 可以手写 但是没有必要 (可以不写 但是不能写错)
mysqli_query($conn,"set names utf8"); // 从数据库取数据时  将编码转为utf-8;  
mysqli_query($conn,"set character set utf-8"); // 向数据库存数据时  将编码转为utf-8

?>